package com.example.sso.clientA.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.example.sso.clientA.entity.SysAccount;
import com.yky.utils.RedisUtils;
import com.yky.vo.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 业务聚合
 *
 * @version [V2.0]
 * @package com.example.controller;
 * @description:[用一句话描述该文件做什么]
 * @author: [zhuben]
 * @date: [2024-01-25 15:10]
 * @copyright: 2024 echovin.com
 */
@RestController
@RequestMapping("user")
public class UsersController {
    @Resource
    private RedisUtils redisUtils;

    @PostMapping("list")
    public Result listUsers(@RequestBody String requestInfo){
        return Result.ok(requestInfo);
    }

    @GetMapping("add")
    public Result addUser(){
        return Result.ok("当前账户："+ StpUtil.getLoginId() +"新增用户信息成功");
    }


    @GetMapping("test")
    public Result test(@RequestParam(value = "b") String a){
        SysAccount sysAccount = new SysAccount();
        sysAccount.setId("1");
        sysAccount.setPwd("1234455");
        sysAccount.setAccountName("zb");
        redisUtils.hset("persion", "1", sysAccount);

        SysAccount persion = redisUtils.hget("persion", "1");
        return Result.ok(persion);
    }

}
